<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 15-8-19
 * Time: 上午10:46
 */
include '/var/www/html/new/d/module/qkxproject/api/all/go_sql/go_sql.php';
$ac = '124529';
$pw = '1fa2237fe32613fd8686b8267b6f3c92';
$inSide = new SoapClient(null, array("location" => "http://localhost/open/openService/pft_insideMX.php", "uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));
 $txt =  json_encode($_GET);
logfile(date('Ymd H:i:s').$txt,'act_log.txt');//记录日志文件
//$txt = '{"VenueID":"","RoundID":"","AreaID":"","SeatID":"","Tnum":"1","Fid":"35707","PayStatus":"1","TicketID":"23081","TouristName":"kx","TouristTel":"18396533082","PlayDate":"2015-08-19 00:00:00","IdCard":"0","Ordern":"1986622","Action":"Relation"}';
$result_array = json_decode($txt,true);


$Action     = $result_array->Action;     //提交方式
$PayStatus  = $result_array->PayStatus;  //支付状态
$Ordern     = $result_array->Ordern;     //票付通订单号
$Tnum       = $result_array->Tnum;       //订单人数
$Fid        = $result_array->Fid;        //分销商id
$TicketID   = $result_array->TicketID;   //门票id
$IdCard     = $result_array->IdCard;     //身份证
$TouristName= $result_array->TouristName;//订单姓名
$PlayDate   = $result_array->PlayDate;   //游玩时间
$TouristTel = $result_array->TouristTel; //订单电话
$ordertime  = $_SERVER['REQUEST_TIME'];
$UUplaytime = date('Ymd',strtotime($PlayDate));
$UUendtime = date('Ymd',strtotime($PlayDate));
$select_uuid = "select uuid from uu_jq_ticket where id=" . $UUtid . " limit 1";
$GLOBALS['le']->query($select_uuid);
$GLOBALS['le']->fetch_assoc();
$uuid = $GLOBALS['le']->f('uuid'); //查询商品编码id


$UUlprice = $inSide->get_Dynamic_Price_Merge(
    $UUpid, $UUplaytime, 1, '', '', 1, 0
); //零售价

$retime2 = microtime(true);

if($Action=='Relation'&&$PayStatus==1){

    return '200|||||';

}

$request_array = array(
                        'TICKETUUID' => $uuid,
                        'ORDERID' => $order_true, //票付通订单号
                        'TICKETORDERID' => $order_true,//票付通订单号
                        'ORDERDATE' =>$ordertime ,
                        'NUMBER' => $IdCard, //身份证号
                        'COUNT' => $Tnum,//人数
                        'PRICE' => $UUlprice,
                        'AMOUNT'=>$request_array['UUtotalmoney']/100,//总金额
                        'QRCODE'=>123, //二维码
                        'BEGINDATE' => $UUplaytime.'000000',
                        'ENDDATE' => $UUendtime.'235959',
                        'TYPE' => 2 ,
                        'SOURCE' => '厦门神游华夏',
                        'MOBILE' => $TouristTel,
                        'NAME' => $TouristName,
                        'NETWORK' => '票付通',
                        'PATH' => 123,
);



//exit(“200||||第三方凭证码|第三方订单号”);

//exit("200||||1234|4567");

function logfile($txt, $path)
{
    $fp = fopen($path, "a");
    flock($fp, LOCK_EX);
    fwrite($fp, $txt . "\n");
    flock($fp, LOCK_UN);
    fclose($fp);
}